package com.xiaoha.pogy.dao;

import com.xiaoha.pogy.dto.ChartData;
import com.xiaoha.pogy.entities.Borrow;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface BorrowRepository extends CrudRepository<Borrow , Long> {
    @Override
    List<Borrow> findAll();
    @Query(nativeQuery = true,value = "SELECT stage AS label, COUNT(*) AS value FROM borrow GROUP BY stage")
    List<ChartData> getBorrowStatus();

    Borrow findByBorrowId(long theId);
}
